package com.stlm2.dems.service;

import com.stlm2.dems.entity.PayChannel;
import com.stlm2.util.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;

import com.stlm2.dems.entity.PayConfig;
import com.stlm2.dems.dao.PayConfigDao;
import com.stlm2.core.base.BaseDao;
import com.stlm2.core.base.impl.BaseServiceImpl;

@Service("payConfigService")
@Transactional(rollbackForClassName={"java.lang.Exception"}, propagation = Propagation.REQUIRED)
public class PayConfigService extends BaseServiceImpl<PayConfig> {

	@Resource
	private PayConfigDao payConfigDao;

	@Override
	protected BaseDao <PayConfig> getDao() {
		return payConfigDao;
	}

    public PayConfig getByCodeChannel(String companyCode, PayChannel payChannel) {
		if(StringUtils.isNullOrEmpty(companyCode))
			companyCode="1";
		PayConfig payConfig=new PayConfig();
		payConfig.setCompanyCode(companyCode);
		payConfig.setPayChannel(payChannel);
		return payConfigDao.getByCodeChannel(payConfig);
    }
}